DEFINITION MODULE VQuery;

(*
VDI Query Functions.

UK __DATE__ __TIME__
*)

(*DEF_SWITCHES*)

FROM VDI        IMPORT RGBList,XY;
FROM PORTAB     IMPORT UNSIGNEDWORD,SIGNEDWORD,ANYWORD,ANYBYTE,ANYPOINTER,
                       UNSIGNEDLONG,ANYTYPE;
FROM VAttribute IMPORT WritingModes,LineTypes,LineEnds,MarkerTypes,
                       TextEffect,
                       HorizontalAlignments,VerticalAlignments,
                       Interiors;
FROM VInput     IMPORT Devices,InputModes;

(* [V]DI: [Ext]e[n]de[d] [Q]uery Function **********************************)

PROCEDURE VQExtnd(    Handle : UNSIGNEDWORD;
                      Flag   : BOOLEAN;
                  VAR WorkOut: ARRAY OF UNSIGNEDWORD);

(* [V]DI: [Q]uery [Color] Representation ***********************************)

PROCEDURE VQColor(    Handle: UNSIGNEDWORD;
                      Color : UNSIGNEDWORD;
                      Flag  : BOOLEAN;
                  VAR RGB   : RGBList): UNSIGNEDWORD;

(* [V]DI: [Q]uery Current [L]ine [Attributes] ******************************)

TYPE LineAttributes = RECORD
#if linear
#if fill_byte
                        FillByte1: ANYBYTE;
#endif
#endif
                        Type  : LineTypes;
#if intel
#if fill_byte
                        FillByte1: ANYBYTE;
#endif
#endif
                        Color : UNSIGNEDWORD;
#if linear
#if fill_byte
                        FillByte2: ANYBYTE;
#endif
#endif
                        Mode  : WritingModes;
#if intel
#if fill_byte
                        FillByte2: ANYBYTE;
#endif
#endif
                        Width : UNSIGNEDWORD;
#if linear
#if fill_byte
                        FillByte3: ANYBYTE;
#endif
#endif
                        Begin : LineEnds;
#if intel
#if fill_byte
                        FillByte3: ANYBYTE;
#endif
#endif
#if linear
#if fill_byte
                        FillByte4: ANYBYTE;
#endif
#endif
                        End   : LineEnds;
#if intel
#if fill_byte
                        FillByte4: ANYBYTE;
#endif
#endif
                      END;

PROCEDURE VQLAttributes(    Handle: UNSIGNEDWORD;
                        VAR Attrib: ARRAY OF ANYTYPE);

(* [V]DI: [Q]uery Current Poly[M]arker [Attributes] ************************)

TYPE MarkerAttributes = RECORD
#if linear
#if fill_byte
                          FillByte1: ANYBYTE;
#endif
#endif
                          Type  : MarkerTypes;
#if intel
#if fill_byte
                          FillByte1: ANYBYTE;
#endif
#endif
                          Color : UNSIGNEDWORD;
#if linear
#if fill_byte
                          FillByte2: ANYBYTE;
#endif
#endif
                          Mode  : WritingModes;
#if intel
#if fill_byte
                          FillByte2: ANYBYTE;
#endif
#endif
                          Width : UNSIGNEDWORD;
                          Height: UNSIGNEDWORD;
                        END;

PROCEDURE VQMAttributes(    Handle: UNSIGNEDWORD;
                        VAR Attrib: ARRAY OF ANYTYPE);

(* [V]DI: [Q]uery Current [F]ill Area [Attributes] *************************)

TYPE FillAttributes = RECORD
#if linear
#if fill_byte
                        FillByte1: ANYBYTE;
#endif
#endif
                        Interior : Interiors;
#if intel
#if fill_byte
                        FillByte1: ANYBYTE;
#endif
#endif
                        Color    : UNSIGNEDWORD;
                        Fill     : UNSIGNEDWORD;
#if linear
#if fill_byte
                        FillByte2: ANYBYTE;
#endif
#endif
                        Mode     : WritingModes;
#if intel
#if fill_byte
                        FillByte2: ANYBYTE;
#endif
#endif
#if linear
#if fill_byte
                        FillByte3: ANYBYTE;
#endif
#endif
                        Perimeter: BOOLEAN;
#if intel
#if fill_byte
                        FillByte3: ANYBYTE;
#endif
#endif
                      END;

PROCEDURE VQFAttributes(    Handle: UNSIGNEDWORD;
                        VAR Attrib: ARRAY OF ANYTYPE);

(* [V]DI: [Q]uery Current Graphic [T]ext [Attributes] **********************)

TYPE TextAttributes = RECORD
                        Font      : UNSIGNEDWORD;
                        Color     : UNSIGNEDWORD;
                        Rotation  : UNSIGNEDWORD;
#if linear
#if fill_byte
                        FillByte1: ANYBYTE;
#endif
#endif
                        Horizontal: HorizontalAlignments;
#if intel
#if fill_byte
                        FillByte1: ANYBYTE;
#endif
#endif
#if linear
#if fill_byte
                        FillByte2: ANYBYTE;
#endif
#endif
                        Vertical  : VerticalAlignments;
#if intel
#if fill_byte
                        FillByte2: ANYBYTE;
#endif
#endif
#if linear
#if fill_byte
                        FillByte3: ANYBYTE;
#endif
#endif
                        Mode      : WritingModes;
#if intel
#if fill_byte
                        FillByte3: ANYBYTE;
#endif
#endif
                        Width     : UNSIGNEDWORD;
                        Height    : UNSIGNEDWORD;
                        CellWidth : UNSIGNEDWORD;
                        CellHeight: UNSIGNEDWORD;
                      END;

PROCEDURE VQTAttributes(    Handle: UNSIGNEDWORD;
                        VAR Attrib: ARRAY OF ANYTYPE);

(* [V]DI: [Q]uery [T]ext [Extent] ******************************************)

PROCEDURE VQTExtent(    Handle: UNSIGNEDWORD;
                    VAR String: ARRAY OF CHAR;
                    VAR Extent: ARRAY OF XY);

(* [V]DI: [Q]uery ([T]ext) Character Cell [Width] **************************)

PROCEDURE VQTWidth(    Handle     : UNSIGNEDWORD;
                       Char       : CHAR;
                   VAR CellWidth  : UNSIGNEDWORD;
                   VAR LeftOffset : UNSIGNEDWORD;
                   VAR RightOffset: UNSIGNEDWORD): SIGNEDWORD;

(* [V]DI: [Q]uery ([T]ext) Face [Name] And Index ***************************)

PROCEDURE VQTName(   Handle: UNSIGNEDWORD;
                     FontNo: UNSIGNEDWORD;
                 VAR Name  : ARRAY OF CHAR;
                 VAR VecFnt: BOOLEAN): UNSIGNEDWORD;

(* [V]DI: [Q]uery [Cell] [Array] *******************************************)

PROCEDURE VQCellArray(    Handle   : UNSIGNEDWORD;
                      VAR PXY      : ARRAY OF XY;
                          RowLength: UNSIGNEDWORD;
                          NumRows  : UNSIGNEDWORD;
                      VAR ElUsed   : UNSIGNEDWORD;
                      VAR RowsUsed : UNSIGNEDWORD;
                      VAR Status   : BOOLEAN;
                      VAR ColArray : ARRAY OF ANYWORD);

(* [V]DI: [Q]uery [In]put [Mode] *******************************************)

PROCEDURE VQInMode(    Handle   : UNSIGNEDWORD;
                       DevType  : Devices;
                   VAR InputMode: InputModes);

(* [V]DI: [Q]uery ([T]ext) Current [Font] [Info]rmation ********************)

PROCEDURE VQTFontInfo(    Handle   : UNSIGNEDWORD;
                      VAR LowADE   : UNSIGNEDWORD;
                      VAR HighADE  : UNSIGNEDWORD;
                      VAR Distances: ARRAY OF UNSIGNEDWORD;
                      VAR MaxWidth : UNSIGNEDWORD;
                      VAR Effects  : ARRAY OF UNSIGNEDWORD);

(* [V]DI: [Q]uery [Justified] [T]ext ***************************************)

PROCEDURE VQTJustified(    Handle   : UNSIGNEDWORD;
                           X        : XY;
                           Y        : XY;
                       VAR String   : ARRAY OF CHAR;
                           Length   : UNSIGNEDWORD;
                           WordSpace: BOOLEAN;
                           CharSpace: BOOLEAN;
                       VAR Offsets  : ARRAY OF UNSIGNEDWORD);

(* [V]DI: [Q]uery Outline Font [T]ext [Advance] Placement Vector ***********)

PROCEDURE VQTAdvance(    Handle: UNSIGNEDWORD;
                         Ch    : CHAR;
                     VAR XAdv  : UNSIGNEDWORD;
                     VAR YAdv  : UNSIGNEDWORD;
                     VAR XRem  : UNSIGNEDWORD;
                     VAR YRem  : UNSIGNEDWORD);

PROCEDURE VQTAdvance32(    Handle: UNSIGNEDWORD;
                           Ch    : CHAR;
                       VAR XAdv  : UNSIGNEDLONG;
                       VAR YAdv  : UNSIGNEDLONG);

(* [V]DI: [Q]uery ([T]ext) [Dev]ice Status [Info]rmation *******************)

PROCEDURE VQTDevInfo(    Handle: UNSIGNEDWORD;
                         Device: UNSIGNEDWORD;
                     VAR Exists: BOOLEAN;
                     VAR DevStr: ARRAY OF CHAR);

(* [V]DI: ([Q]uery [T]ext) [Get] Character Mapping [Table] *****************)

PROCEDURE VQTGetTable(    Handle: UNSIGNEDWORD;
                      VAR Map   : ANYPOINTER);

(* [V]DI: ([Q]uery [T]ext) [Cache] [Size] **********************************)

PROCEDURE VQTCacheSize(    Handle: UNSIGNEDWORD;
                           Cache : UNSIGNEDWORD;
                       VAR Size  : UNSIGNEDLONG);

(* [V]DI: [Q]uery Outline [F]ont [T]ext [Extent] ***************************)

PROCEDURE VQTFExtent(    Handle: UNSIGNEDWORD;
                     VAR String: ARRAY OF CHAR;
                     VAR Extent: ARRAY OF XY);

(* [V]DI: [Q]uery Outline Font [T]ext [Font] [Header] **********************)

PROCEDURE VQTFontHeader(    Handle: UNSIGNEDWORD;
                        VAR Buffer: ARRAY OF ANYTYPE;
                        VAR Path  : ARRAY OF CHAR);

(* [V]DI: [Q]uery Outline Font [T]ext [Track] [Kern]ing] Information *******)

PROCEDURE VQTTrackKern(    Handle: UNSIGNEDWORD;
                       VAR X     : UNSIGNEDLONG;
                       VAR Y     : UNSIGNEDLONG);

(* [V]DI: [Q]uery Outline Font [T]ext [Pair] [Kern]ing Information *********)

PROCEDURE VQTPairKern(    Handle: UNSIGNEDWORD;
                          Ch1   : CHAR;
                          Ch2   : CHAR;
                      VAR X     : UNSIGNEDLONG;
                      VAR Y     : UNSIGNEDLONG);

(* [V]DI: ([Q]uery Outline Font [T]ext) [Get] Character [Bitmap] [Info]rmation *)

PROCEDURE VGetBitmapInfo(    Handle: UNSIGNEDWORD;
                             Ch    : CHAR;
                         VAR AdvX  : UNSIGNEDLONG;
                         VAR AdvY  : UNSIGNEDLONG;
                         VAR XOff  : UNSIGNEDLONG;
                         VAR YOff  : UNSIGNEDLONG;
                         VAR Width : UNSIGNEDWORD;
                         VAR Height: UNSIGNEDWORD;
                         VAR Bitmap: ANYPOINTER);

END VQuery.
